package com.wsh.crawler.constant;

import lombok.Getter;
import lombok.ToString;

/**
 * 资讯来源枚举
 * */
@Getter
@ToString
public enum NewsSourceEnum {
    FLASHSCORE("FlashScore", "https://www.flashscore.com/news/football/"),
    PREMIER_LEAGUE("Premier League", "https://www.premierleague.com/news"),
    LA_LIGA("La Liga", "https://www.laliga.com/en-CN/news"),
    BUNDESLIGA("Bundesliga", "https://www.bundesliga.com/en/history"),
    SERIE_A("Serie A", "https://www.legaseriea.it/it/latest"),
    LIGUE_1("Ligue 1", "https://ligue1.com/articles?competition=ligue1mcdonalds");

    private final String name;
    private final String baseUrl;

    NewsSourceEnum(String name, String baseUrl) {
        this.name = name;
        this.baseUrl = baseUrl;
    }

    public static NewsSourceEnum fromName(String name) {
        for (NewsSourceEnum value : values()) {
            if (value.name.equals(name)) {
                return value;
            }
        }
        return null;
    }
}
